home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <sys/types.h>
- #include <fcntl.h>
- #include "crtlocal.h"
-
- int ftruncate(int fd, off_t off)
- {
- OSErr err;
- ParamBlockRec pbr;
- if (crt_fd_tab[fd].flags & O_PIPE)
- {
- return 0;
- }
- if (crt_fd_tab[fd].flags & O_CATALOG)
- {
- return 0;
- }
- pbr.ioParam.ioRefNum = crt_fd_tab[fd].fd;
- pbr.ioParam.ioPosMode = fsFromStart;
- pbr.ioParam.ioPosOffset = off;
- pbr.ioParam.ioMisc = (Ptr)off;
- err = PBSetEOFSync(&pbr);
- errtran(err);
- return err ? -1:0;
- }
-